﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Delonix_Regia_Hotel_Management_System.Class;

namespace Delonix_Regia_Hotel_Management_System
{
    public partial class View_Staff_Information : Form
    {
        public View_Staff_Information()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form1 F = new Form1();
            this.Hide();
            F.Show(); 
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (LogInClass.position == "Administrator")
            {
                Main__Management_and_Administrator_ mainA = new Main__Management_and_Administrator_();
                this.Hide();
                mainA.Show();
            }
            else
            {
                Main__Receptionist_ mainR = new Main__Receptionist_();
                this.Hide();
                mainR.Show();
            }
        }

        private void btnRetrieve_Click(object sender, EventArgs e)
        {
            List<Staff> staff = DBManager.getAllStaff();
            dataGridView1.DataSource = staff;
            if (staff.Count > 0)
            {
                dataGridView1.Columns["dob"].Visible = false;
                dataGridView1.Columns["bankAccount"].Visible = false;
                dataGridView1.Columns["staffPassword"].Visible = false;
            }
            DataGridViewCheckBoxColumn reorderCol1 = new DataGridViewCheckBoxColumn();
            dataGridView1.Columns.Add(reorderCol1);
        }

        private void btnShow_Click(object sender, EventArgs e)
        {
            Staff s = new Staff();

            string staffId = tbxStaffId.Text;

            s = DBManager.GetStaffID(staffId);

            BindingSource binding = new BindingSource();
            binding.DataSource = s;
            dataGridView1.DataSource = binding;
            if (binding.Count > 0)
            {
                dataGridView1.Columns["dob"].Visible = false;
                dataGridView1.Columns["bankAccount"].Visible = false;
                dataGridView1.Columns["staffPassword"].Visible = false;
            }
            //DataGridViewCheckBoxColumn reorderCol1 = new DataGridViewCheckBoxColumn();
            //dataGridView1.Columns.Add(reorderCol1);
        }
    }
}
